package com.volcreate.week2_3.no4;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

/**
 * @author zxc
 * @date 2020/9/21
 */
class PersonOverride {
    private String name;
    private int age;
    private boolean gender;

    public PersonOverride() {
        this("default", 1, true);
    }

    public PersonOverride(String name, int age, boolean gender) {
        this.name = name;
        this.age = age;
        this.gender = gender;
    }



    @Override
    public String toString() {
        return name + "-" + age + "-" + gender;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        PersonOverride other = (PersonOverride) obj;
        if (age != other.age)
            return false;
        if (gender != other.gender)
            return false;
        if (name == null) {
            if (other.name != null)
                return false;
        } else if (!name.equals(other.name))
            return false;
        return true;
    }
}

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n1 = scanner.nextInt();
        ArrayList<PersonOverride> persons1 = new ArrayList<>();
        for (int i = 0; i < n1; i++) {
            PersonOverride personOverride = new PersonOverride();
            persons1.add(personOverride);
        }
        int n2 = scanner.nextInt();
        ArrayList<PersonOverride> persons2 = new ArrayList<>();
        for (int i = 0; i < n2; i++) {
            String name = scanner.next();
            int age = scanner.nextInt();
            boolean gender = scanner.nextBoolean();
            PersonOverride personOverride = new PersonOverride(name, age, gender);
            if (!persons2.contains(personOverride)){
                persons2.add(personOverride);
            }
        }
        persons1.forEach(System.out::println);
        persons2.forEach(System.out::println);
        System.out.println(persons2.size());
        System.out.println(Arrays.toString(PersonOverride.class.getConstructors()));
    }
}
